<?php

/**
 * IndexController - The default controller class
 *
 * @author
 * @version
 */

require_once 'Zend/Controller/Action.php';

class Administrator_OrderController extends Zend_Controller_Action
{



    public function init()
    {
		$member = new CMember();
        $memberArray = $member->getUserDetails(array('uid' => $_COOKIE[COOKIE_PRE.'uid']));
    	if($_COOKIE[COOKIE_PRE.'uid']=='1'){
				
		} else {
        	$strarray = explode(",", $memberArray[0]['menuflag']);
        	
        	if ($this->_getParam('action') == 'search') {
        		if (!in_array('13', $strarray)) {
        			exit('no priviage');
        		}
        	} elseif ($this->_getParam('action') == 'getitemajax') {
        		if (!in_array('1', $strarray) && !in_array('13', $strarray)) {
        			exit('no priviage');
        		}
        	} else {
        		if (!in_array('1', $strarray)) {
        			exit('no priviage');
        		}
        	}
		}		
    }

    public function preDispatch()
    {

        $this->getHelper ('layout')->setLayout('framelayout');

        $this->view->addHelperPath(MY_ROOT.'/vhelpers');

        Zend_Controller_Action_HelperBroker::addPath(MY_ROOT.'/chelpers');

        $member=new CMember();

        if(!$member->isUser($this->_request->getModuleName(),$this->_request->getControllerName()))
        {

            $this->_redirect(MY_URL.'/administrator-auth-login');

            return false;

        }

        return true;

    }


    public function indexAction()
    {

        $orderfl=new CFenlei('order');

        $fenleiArray=$orderfl->getAllFenlei();

        $orderfl->getAll($fenleiArray,0);

        $fenleiString=str_replace(array('<div class="smallChildDiv"></div>','<div></div>'),array('',''),$orderfl->fenleiString);

        $this->view->assign('fenleiString',$fenleiString);

        $this->view->assign('fenleiArray',$fenleiArray);

    }
    
	public function searchAction()
    {
		
        $orderfl=new CFenlei('order');

        $fenleiArray=$orderfl->getAllFenlei();

        $orderfl->getAll($fenleiArray,0);

        $fenleiString=str_replace(array('<div class="smallChildDiv"></div>','<div></div>'),array('',''),$orderfl->fenleiString);

        $this->view->assign('fenleiString',$fenleiString);

        $this->view->assign('fenleiArray',$fenleiArray);

    }

    public function getitemajaxAction()
    {

        $this->getHelper ('layout')->disableLayout ();

        $flid=$this->_request->getParam('flid',0);

        $page=$this->_request->getParam('page',1);

        $searchQuery=$this->_request->getParam('searchQuery','');

        $searchArray=json_decode(stripslashes($searchQuery),true);
	
        $order=new COrder();

        $where=array();

        if($flid!=0)
        {

            $where[]=R_PRE."orders.flid='$flid'";

        }

        if($searchArray['orderid']!='')
        {

            $where[]="orderid='".$searchArray['orderid']."'";

        }

        if($searchArray['sendid']!='')
        {

            $where[]="sendid='".$searchArray['sendid']."'";

        }

        if($searchArray['time_from']!='')
        {

            $searchArray['time_from']=strtotime($searchArray['time_from']);

            $where[]="add_time>'".$searchArray['time_from']."'";

        }

        if($searchArray['time_to']!='')
        {

            $searchArray['time_to']=strtotime($searchArray['time_to']);

            $where[]="add_time<'".$searchArray['time_to']."'";

        }

        if($searchArray['buyer']!='')
        {

            $member=new CMember();

            $userArray=$member->getUserDetails(array('username'=>$searchArray['buyer']));

            $where[]=R_PRE."orders.uid='".$userArray[0]['uid']."'";

        }

        if($searchArray['seller']!='')
        {

            $member=new CMember();

            $userArray=$member->getUserDetails(array('username'=>$searchArray['seller']));

            $where[]="seller_uid='".$userArray[0]['uid']."'";

        }

        if($searchArray['money_from']!='')
        {

            $where[]="money>'".$searchArray['money_from']."'";

        }

        if($searchArray['money_to']!='')
        {

            $where[]="money<'".$searchArray['money_to']."'";

        }
        
     	if($searchArray['email_paypal']!='')
        {

            $where[]="email_paypal='".$searchArray['email_paypal']."'";

        }

        if($searchArray['flid2']!='0'&&$searchArray['flid2']!='')
        {

            $where[]=R_PRE."orders.flid='".$searchArray['flid2']."'";

        }

        $where=join(' AND ',$where);
        
        $contact_name = $searchArray['contact_name'];

        $orderCounts=$order->getAllOrderCounts(0,$where,0,$contact_name);


        Zend_Loader::loadClass("CFilter");

        $pageArray = CFilter::filterPage ( $page, $orderCounts, 10 );

        $orderArray=$order->getAllOrders($pageArray['from'],10,0,$where, 0, $contact_name);

        Zend_Loader::loadClass("CPage");

        $pageString = CPage::commonDivAjax($pageArray ['pageNumber'], $pageArray ['page'], 'productEffection.showAll',$flid); //生成分页字符串

        $this->view->assign ( "pageString", $pageString );

        $this->view->assign ( "pageArray", $pageArray );

        $this->view->assign ( 'orderArray', $orderArray );

    }

    public function docancelAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');

        $order=new COrder();

        $orderArray=$order->getDetail($orderid);

        if($orderArray[0]['flid']=='1')
        {

            $order->editOrder($orderid,array('flid'=>7));

            $this->view->showMsg('订单正常取消!');

        }else if($orderArray[0]['flid']=='2')
        {

            $order->editOrder($orderid,array('flid'=>8));

            $this->view->showMsg('订单非正常取消! ');

        }else if($orderArray[0]['flid']=='7'||$orderArray[0]['flid']=='8')
        {

            $this->view->showMsg('订单已经取消了!');

        }else
        {

            $this->view->showMsg('订单不能取消!');

        }

    }

    public function moreAction()
    {

        $orderid=$this->_request->getParam('orderid');

        $order=new COrder();

        $CLagnappe=new CLagnappe();
        $attachment3=new CLagnappeAttachment();
        $orderArray=$order->getDetail($orderid);

        if($orderArray[0]["lagnappe"])
        {
            $LagnappeArray=$CLagnappe->getDetail($orderArray[0]["lagnappe"]);
            $attachmentArray3=$attachment3->getAttachments($orderArray[0]["lagnappe"]);
        }
        $this->view->assign('orderArray',$orderArray);

        $this->view->assign('attachmentArray3',$attachmentArray3);

        $this->view->assign('LagnappeArray',$LagnappeArray);
		
        $itemArray=array();
        //die($orderArray[0]['order_string']);
        //eval('$itemArray='.$orderArray[0]['order_string'].';');
        $itemArray=unserialize(stripslashes($orderArray[0]['order_string']));
        
        $this->view->assign('itemArray',$itemArray);

        $orderfl=new CFenlei('order');

        $orderStateArray=$orderfl->getFenleiByPid(0);

        $this->view->assign('orderStateArray',$orderStateArray);

        $attachment=new COrderAttachment();

        $attachmentArray=$attachment->getAttachments($orderid);

        $this->view->assign('attachmentArray',$attachmentArray);

        $attachment->setIsSeller(0);

        $attachmentArray2=$attachment->getAttachments($orderid);

        $this->view->assign('attachmentArray2',$attachmentArray2);

        $orderRemark=new COrderRemark();

        $disputeRemarkArray=$orderRemark->getRemarkDetails(array('orderid'=>$orderid,'flid'=>'1'));

        $this->view->assign('disputeRemarkArray',$disputeRemarkArray);

        $reimburseRemarkArray=$orderRemark->getRemarkDetails(array('orderid'=>$orderid,'flid'=>'2'));

        $this->view->assign('reimburseRemarkArray',$reimburseRemarkArray);

        $cancelDisputeRemarkArray=$orderRemark->getRemarkDetails(array('orderid'=>$orderid,'flid'=>'3'));

        $this->view->assign('cancelDisputeRemarkArray',$cancelDisputeRemarkArray);

        $cancelReimbursementArray=$orderRemark->getRemarkDetails(array('orderid'=>$orderid,'flid'=>'4'));

        $this->view->assign('cancelReimbursementArray',$cancelReimbursementArray);

        $orderItem=new COrderItem();

        $orderItemArray=$orderItem->getDetail($orderid,$itemArray[0]['itemid']);
        
        $this->view->assign('orderItemArray',$orderItemArray);

        $orderDelay=new COrderDelay();

        $orderDelayArray=$orderDelay->getDelayDetails(array('orderid'=>$orderid));

        $this->view->assign('orderDelayArray',$orderDelayArray);

        $account=new CAccount();

        $reimburseAccountArray=$account->getAccountDetails(array('orderid_string'=>serialize(array($orderid)),'flid'=>5));

        $this->view->assign('reimburseAccountArray',$reimburseAccountArray);
        
        $Cyunfei=new Cyunfei();

        $oneyunfeiArray=$Cyunfei->getDetail($orderArray[0]["yunfeiid"]);
        
        $this->view->assign('oneyunfeiArray',$oneyunfeiArray);
        
    }

    public function uploadimgAction()
    {

        header("Content-type: text/html; charset=utf-8");

        $this->getHelper ('layout')->disableLayout ();

        $orderid=$this->_request->getParam('orderid');

        $upload=new CUpload();

        $path=new CPath();

        $image=new CImage();

        $thisPath=$path->getPathFromType('item');

        $imageArray=$upload->uploadFile($thisPath,null,null,'500000');

        $cutPath=$image->cutPhoto($thisPath, '200', $path->getPathFromType('cut_item'));//截图

        $isSuccess=false;

        if(is_array($imageArray))
        {

            $isSuccess=true;

            $imgUrl=$path->toDbPath('item',$imageArray[0]);

            $this->view->assign('imgUrl',$imgUrl);

            $attachment=new COrderAttachment();

            $data=array(
                    'orderid'=>$orderid,
                    'attachment_url'=>$imgUrl,
                    'intro'=>'',
                    'cut_url'=>$cutPath,
                    'ordering'=>0,
                    'is_seller'=>0,
            );

            $attachmentid=$attachment->createAttachments($data);

            $this->view->assign('attachmentid',$attachmentid);

        }else
        {

            $error=$imageArray;

            $this->view->assign('error',$error);

        }

        $this->view->assign('isSuccess',$isSuccess);

    }

    public function delimgbyidAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $this->getHelper ('layout')->disableLayout ();

        $attachmentid=$this->_request->getParam('attachmentid');

        $attachment=new COrderAttachment();

        $attachmentArray=$attachment->getAttachmentByAttachmentid($attachmentid);

        $attachment_url=$attachmentArray['attachment_url'];

        $cut_url=$attachmentArray['cut_url'];


        $path=new CPath();

        @unlink($path->toAbsoluteRootPath($attachment_url));

        @unlink($path->toAbsoluteRootPath($cut_url));



        $attachment->delAttachmentsById(array($attachmentid));

        echo 'success';


    }


    public function expressAction()
    {

        $orderid=$this->_request->getParam('orderid');

        $itemid=$this->_request->getParam('itemid');

        $order=new COrder();

        $orderArray=$order->getDetail($orderid);

        $this->view->assign('orderArray',$orderArray);

        $orderContact=new COrderContact();
        if($orderArray[0]['contactid'])
        {
            $buyerContactArray=$orderContact->getContactByid($orderArray[0]['contactid']);
        }else
        {
            $buyerContactArray=$orderContact->getContactByUid($orderArray[0]['uid']);
        }

        $this->view->assign('buyerContactArray',$buyerContactArray);

        $this->view->assign('orderid',$orderid);

        $this->view->assign('itemid',$itemid);

    }

    public function doconfirmAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');

        $itemid=$this->_request->getParam('itemid');

        $orderItem=new COrderItem();

        $orderItem->editOrderItem($orderid,$itemid,array('has_shipped'=>1));

        $orderItemCounts=$orderItem->getOrderItemCounts($orderid);

        $order=new COrder();

        $orderArray=$order->getDetail($orderid);

        $itemArray=array();

        //eval('$itemArray='.$orderArray[0]['order_string'].';');
        $itemArray=unserialize($orderArray[0]['order_string']);

        if($orderItemCounts==count($itemArray))
        {

            $order->editOrder($orderid,array('flid'=>4,'ship_time'=>time()));

        }


        $this->view->showMsg('确认已经发货!');

    }

    public function setoderflAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');

        $flid=$this->_request->getParam('flid');

        $order=new COrder();

        $order->editOrder($orderid,array('flid'=>$flid));

        $this->view->showMsg('更改状态成功!');

    }

    public function setstateAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');

        $state=$this->_request->getParam('state');
		$order=new COrder();
        if($state==3)
        {
            $uid=$this->_request->getParam('uid');

            $acctualTotal=$this->_request->getParam('acctualTotal');
            //die($acctualTotal);
//            $member=new CMember();
//
//            $member->updateIntegral(((int)($acctualTotal/INTEGRALDH)),$uid,1);
			$orderRow = $order->getDetail($orderid);
			if ($orderRow[0]['order_score_statu'] == 0 && $orderRow[0]['score_pay_statu'] == 0 && $orderRow[0]['email_paypal'] != "''") {
		        $score = new CScore();
		    	if ($score->orderScore('statu') == 1) {
			    	$score->updateIntegralByDollar($acctualTotal, $uid);
			    	$fenlei = new CFenlei('product');
			    	$fenlei->refreshIntegral();		    	
	        		$order->editOrder($orderid,array('order_score_statu'=>1, 'score_pay_statu'=>1));
		    	}          		
			}
			//删除购物车
			$cart = new CCart();
			$cart->delete('cart_session_id = "' . $orderRow[0]['cart_session_id'] . '"');
			if (empty($orderRow[0]['pay_time'])) {
				$order->editOrder($orderid,array('pay_time'=>time()));
			}
			
			$account = new CAccount();
            $sign = $orderid;

            $accountArray = $account->getAccountDetails(array('sign' => $sign));

            if (count($accountArray) == 0)
            {
                /* 财务 */
                $accountData = array(
                    'should_paid' => $orderRow[0]['money'],
                    'has_paid' => $orderRow[0]['money'],
                    'flid' => 1,
                    'state' => 1,
                    'orderid_string' => serialize($orderid),
                    'from_uid' => $uid,
                    'to_uid' => 0,
                    'add_time' => time(),
                    'payment' => 'Paypal',
                    'remark' => ''
                );

                $account->createAccount($accountData);
                /* 财务 */
            } else
            {
                $accountData = array(
                    'should_paid' => $orderRow[0]['money'],
                    'has_paid' => $orderRow[0]['money'],
                    'flid' => 1,
                    'state' => 1,
                    'orderid_string' => serialize($orderid),
                    'from_uid' => $uid,
                    'to_uid' => 0,
                    'add_time' => time(),
                    'payment' => 'Paypal',
                    'remark' => ''
                );

                $account->editAccount($accountArray[0]['accountid'], $accountData);				
            }     
	        $confirmation = new CConfirmation();
	        $data = array(
	            'uid' => $uid,
	            'orderid_string' => serialize($orderid),
	            'confirm_string' => serialize($allInfoArray),
	            'add_time' => time(),
	            'is_valid' => 1,
	            'total' => "0" . $orderRow[0]['money'],
	            'paid_total' => $orderRow[0]['money'],
	        );
	        $confirmation->createConfirmation($data);
        }
        
        if ($state == 4) {
        	 $order->editOrder($orderid,array('ship_time'=>time()));
        	 //更新库存
        	 $product = new CProduct();
        	 $orderRow = $order->getDetail($orderid);
        	 $orderArr = unserialize(stripslashes($orderRow[0]['order_string']));
        	 foreach ($orderArr as $v) {
	        	 $sizeArr = explode(',', $v['buy_pattern_size']);
				 foreach ($sizeArr as $v1) {
					 preg_match('/(.*):(\d+)/', $v1, $match);										
					 if ($match) {	
						 $product->updatePatternStock($match[1], $match[2], $v['itemid']);
					 }
				 } 
        	 }
        }
        
        if ($state == 9) {
        	$mlm = new CMlm();
        	$mlm->dispatchRebate($orderid);
        	
        	$amorderModel = new CAmOrder();
        	$rows = $amorderModel->getAmOrderDetail($orderid);
        	
        	if(!empty($rows)&&$rows['iscomplete']==0){
        		$db = $amorderModel->getAdapter();
        		$ammemberModel = new CAmmember();
        		$uidrow = $ammemberModel->getUidByCode($rows['relatecode']);
        	
        		$db->beginTransaction();
        	
        		try {
        			$cash = $rows['money']/10;
        			$res = $ammemberModel->addCash($uidrow->uid, $cash);
        			if($res){
        				$amorderModel->updateStatus($orderid,1);
        			}
        			$db->commit();
        		} catch (Exception $e) {
        			$db->rollback();
        		}
        	
        	}
        }
        
		if ($state == 7 || $state == 8) { //取消，加回原积分,不管了
			CStock::update($orderid, 'add'); //加回库存
		}
		
		if ($state == 2) {
			$flashItemLog = new CFlashitemorderlog(); 
			$row = $flashItemLog->fetchRow(array('orderid = ?'=>$orderid));
			if (!$row) {
				$flashCommon = new CFlashcommon();				
				$orderRow = $order->getDetail($orderid);
				$flashCommon->addItem($orderRow[0]['uid'], 10);	  
				$flashItemLog->insert(array('orderid'=>$orderid, 'buy_count'=>10, 'add_time'=>time()));
			}
		}
		

        $order->editOrder($orderid,array('flid'=>$state));

        $this->view->showMsg('更改状态成功!',$_SERVER['HTTP_REFERER']);

    }

    public function setcompleteAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');

        $order=new COrder();

        $order->editOrder($orderid,array('flid'=>9));

        $this->view->showMsg('成功把订单设为完成状态!',$_SERVER['HTTP_REFERER']);

    }

    public function setshippedAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');

        $order=new COrder();

        $order->editOrder($orderid,array('flid'=>4));

        $this->view->showMsg('成功把订单设为已发货状态!',$_SERVER['HTTP_REFERER']);

    }
    public function setsendidAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');
        $usernameemail=$this->_request->getParam('usernameemail');

        $yunfeicarrier=$this->_request->getParam('yunfeicarrier');
        $transittime=$this->_request->getParam('transittime');
        $website=$this->_request->getParam('website');

        $sendid=$this->_request->getParam('sendid');
        $order=new COrder();

        $order->editOrder($orderid,array('sendid'=>$sendid));



        $config=new CConfigorderemail();

        $array=$config->getAllConfigorderemail();

        $configArray=array();

        foreach ($array as $value)
        {

            $configArray[$value['name']]=$value['data'];

        }
		$order=new COrder();
        $orderArray = $order->getDetail($orderid);
        $orderContact=new COrderContact();
        $buyerContactArray=$orderContact->getContactByid($orderArray[0]['contactid']);
        $to = $buyerContactArray[0]['email'];
        $subject = $configArray['EMAIL_TITLE'];
        $message = str_replace("{#sendid}",$sendid.' '.$yunfeiinfo,(str_replace("{#orderid}", $orderid, $configArray['EMAIL_BODY'])));
        $message = str_replace("\r\n","<br>",$message);
        $message = str_replace("{#Carrier}",$yunfeicarrier,$message);
        $message = str_replace("{#TransitTime}",$transittime,$message);
        $message = str_replace("{#WebSite}",$website,$message);

        $message = str_replace("\r\n","<br>",$message);
        $from = $configArray['EMAIL_BOX'];
        $headers = "MIME-Version: 1.0" . "\r\n";
        $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
        $headers .= "From: $from";
        //mail($to,$subject,$message,$headers);
        $mailer=new CMail();
        $mailer->sendEmail($from, $to, $subject, $message); 
        $this->view->showMsg('成功输入运单号!,并了发邮件,给客户',$_SERVER['HTTP_REFERER']);

    }

    public function doapproveAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $has_approved=$this->_request->getParam('has_approved');

        $orderid=$this->_request->getParam('orderid');

        $orderDelay=new COrderDelay();

        $data=array('has_approved'=>$has_approved);

        $orderDelay->editDelay($orderid,$data);

        $order=new COrder();

        $orderDelayArray=$orderDelay->getDelayDetails(array('orderid'=>$orderid));

        if($has_approved=='1')
        {

            $order->updateDeliveryDay($orderDelayArray[0]['delay_days'],$orderid,true);

        }

        $this->view->showMsg('设置成功！',$_SERVER['HTTP_REFERER']);

    }

    public function doaccidentcostAction()
    {

        $this->_helper->viewRenderer->setNoRender();

        $orderid=$this->_request->getParam('orderid');

        $accident_cost=$this->_request->getParam('accident_cost');

        $accident_cost_reason=$this->_request->getParam('accident_cost_reason');

        $order=new COrder();

        $order->editOrder($orderid,array('accident_cost'=>$accident_cost,'accident_cost_reason'=>$accident_cost_reason));

        $this->view->showMsg('设置成功！',$_SERVER['HTTP_REFERER']);

    }

    public function postAction()
    {

        //$this->_helper->viewRenderer->setNoRender();

        //$this->getHelper ('layout')->disableLayout ();

    }
    
    public function printordersAction()
    {
    	$this->getHelper ('layout')->disableLayout ();
    	$orderidprint = $this->_request->getParam('orderidprint');
    	if(is_array($orderidprint) && !empty($orderidprint)) {
    		$order=new COrder();
    		$ids = '';
    		foreach ($orderidprint as $orderid) {
    			if($orderid == '')
    				continue;
    			$ids .= $orderid . ',';
    		}
    		$ids = substr($ids, 0, strlen($ids) - 1);
    		if($ids == '')
    			die('错误的参数!');
    		$orders_array = $order->getAllOrdersByIds($ids);
    		$this->view->assign('orders_array',$orders_array);
    		
    	} else {
    		die('错误的参数!');
    	}
    }
	
    public function suggestionAction()
    {
    	$this->_helper->viewRenderer->setNoRender();

        $id=$this->_request->getParam('id');

    	$suggestionModel = new CSuggestion();
    	$suggestion = $suggestionModel->find($id)->current();
    	$suggestionModel->change(1,$id);
    	
    	$data=array(
    				'from_uid'=>1,
    				'to_uid'=>$suggestion->uid,
    				'add_time'=>time(),
    				'subject'=>'Congratulations!! We accepted your opinion',
    				'content'=>'Congratulations!! We accepted your opinion, please send an e-mail to housinghouse@live.cn to ask for one free jersey in your new order!',
    				'has_read'=>0,
    				'flid'=>1,
    			   );
    			   
    	$pm=new CPm();
    	
    	$pm->createPm($data);

        $this->view->showMsg('设置成功！',$_SERVER['HTTP_REFERER']);
    }
    public function presaleorderAction(){
    	$orderArray = array();
    	$page = $this->_getParam('page');
    	$preorderModel = new CPreorder();
    	$orderModel = new COrder();
    	$presale = new CProductpresale();
    	
    	$rows = $preorderModel->getPreorderdetail();
    	foreach($rows as $k=>$v){
    		$orderArray[$k]['preorder']=$orderModel->getDetail($v['orderid']);
    		$preprodct=$presale->getPresaleproduct($v['itemid']);
    		$orderArray[$k]['preorder']['preprice']=$preprodct[0]['preprice'];
    		if($v['relate_orderid']!=0){
    			$orderArray[$k]['related']=$orderModel->getDetail($v['relate_orderid']);
    		}
    	}
    	//print_r($orderArray);die;
    	$this->view->assign('orderArray',$orderArray);
    	$itemCounts= count($orderArray);
    	Zend_Loader::loadClass("CFilter");

        $pageArray = CFilter::filterPage ( $page, $itemCounts, 10 );
		
        Zend_Loader::loadClass("CPage");

        $pageString = CPage::divPages($pageArray ['pageNumber'], $pageArray ['page'], ROOT_PATH . "/administrator-order-presaleorder?page=$page"); //生成分页字符串
        $this->view->assign ( "pageString", $pageString );

        $this->view->assign ( "pageArray", $pageArray );
    	 
    }

}
